package org.jeecg.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.domain.dto.InstStaffDto;
import org.jeecg.domain.po.InstitutionStaff;
import org.jeecg.service.InstitutionStaffService;
import org.jeecg.mapper.InstitutionStaffMapper;
import org.jeecg.utils.ResponseResult;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 32327
* @description 针对表【institution_staff(机构下属服务人员)】的数据库操作Service实现
* @createDate 2025-01-02 15:26:27
*/
@Service
public class InstitutionStaffServiceImpl extends ServiceImpl<InstitutionStaffMapper, InstitutionStaff>
    implements InstitutionStaffService{

    @Override
    public ResponseResult findPage(InstStaffDto dto) {
        System.out.println(dto);
        IPage page = new Page(dto.getPageNum(), dto.getPageSize());
        LambdaQueryWrapper<InstitutionStaff> like = Wrappers.<InstitutionStaff>lambdaQuery()
                .like(dto.getName() != null, InstitutionStaff::getName, dto.getName())
                .like(dto.getPhone() != null, InstitutionStaff::getPhone, dto.getPhone());
        this.page(page, like);
        return ResponseResult.okResult(page);
    }

    @Override
    public ResponseResult deleteById(String id) {
        boolean b = this.removeById(id);
        return b?ResponseResult.okResult("删除成功"):ResponseResult.errorResult(500,"删除失败");
    }
}




